//Add libraries for using the LED Matrices
#include <RGB.h>
#include <RGBMatrix.h>

//Define how many LED matrices are connected to create the frame.
int NUM_BOARDS = 4;

//Colors are defined in the RGB.h file
//Creating an array of the colors makes them easier to cycle through. Read the rest of the sketch to see how this is done.

const unsigned int countColors = 4;
char colors[countColors] = {BLACK, RED, GREEN, ORANGE};

void setup()
{
    RGBMatrix.begin(NUM_BOARDS);    //Start the communication with the LED matrices.
    Serial.begin(9600);
}

void loop()
{

  
    for(char color=1; color< countColors; color++)
    {
        RGBMatrix.clear();
        //Start the loop at the first board in the frame.
        for(int board=NUM_BOARDS-1; board>=0; board--)
        {
            //Start filling columns from the left side of the board.
            for(int column=NUM_COLUMNS-1; column>=0; column--)
            {
                RGBMatrix.fillColumn(board, column, colors[color]);
                //Update the display every time we color a new column.
                RGBMatrix.display();
            }
        }    
        delay(4000);
    }
}

